<?php
/*
 * @Author: 小悟空56
 * @Date: 2021-04-16 20:16:21
 * @LastEditTime: 2022-04-12 20:44:32
 * @LastEditors: 小悟空56
 * @Description: 
 * @FilePath: \copy.copy.com\app\management\controller\Index.php
 * 白月光
 */
declare (strict_types = 1);

namespace app\management\controller;

use app\management\facade\IndexFacade;
use app\Request;
use think\facade\View;
use PullWord\PullWord;
use think\facade\Db;

/**
 * Class Index
 * @package app\management\controller
 *
 * 访客统计，总览表
 */
class Index
{
    /**
     * @return string
     * 实时统计
     */
    public function index()
    {
        return '您好！这是一个[management]示例应用';
    }

    /**
     * @return string
     * 实时统计
     * 域名列表   访问次数    复制次数      查看访问详情     查看复制详情
     */
    public function everyTime(Request $request){

        if ($request->isPost()){
          return IndexFacade::getUrlList();
        }
       return View::fetch();
    }

    public function everyTimeWord(){
       $sql = Db::table('every_times')->where('id',1420)->value('key_word');
       var_dump($sql);
       echo '<br>';
       $fenci=  new \WordAnalysis\Analysis(); 
       $arr1 =$fenci->getKeywords($sql);
       $a1 =explode(',',$arr1);
       var_dump($a1);
       echo '<br>';
       $arr =$fenci->getKeywords('三岁小孩几天不拉大便怎么办');
       
       $a2 =explode(',',$arr);
       var_dump($a2);
       echo '<br>交集数组<br>';
       var_dump(array_intersect($a1,$a2));
        // return '实时统计搜索词';
    }

    public function test(){
        var_dump(IndexFacade::getUrlList());
    }
}
